import 'package:flutter/material.dart';
import 'dart:io';
import 'package:device_info/device_info.dart';
class DevicePage extends StatefulWidget {
  DevicePage({Key key}) : super(key: key);

  _DevicePageState createState() => _DevicePageState();
}

class _DevicePageState extends State<DevicePage> {
  Map info = {};
  @override
  void initState() { 
    super.initState();
    // _getDevice();
  }
   _getDevice() async{
    DeviceInfoPlugin deviceInfo = DeviceInfoPlugin();

     
    if(Platform.isIOS){
       IosDeviceInfo iosInfo = await deviceInfo.iosInfo; 
        this.info = {
           'name':iosInfo.name,
           'systemName':iosInfo.systemName,
           'systemVersion':iosInfo.systemVersion,
           'model':iosInfo.model,
           'localizedModel':iosInfo.localizedModel,
           'identifierForVendor':iosInfo.identifierForVendor,
           'isPhysicalDevice':iosInfo.isPhysicalDevice,
         };
       
       
        // return tempList.toList();
        
    }else if(Platform.isAndroid){
       AndroidDeviceInfo androidInfo = await deviceInfo.androidInfo;
       print('Running on ${androidInfo.model}');  // e.g. "Moto G (4)"
    } 
    
  }
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: Text("DevicePage"),
      ), 
    );
  }
}